﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="goodsAdd.aspx.cs" Inherits="WebApp.admin.goods.goodsAdd" %>


<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>添加商品 </title>
    <link href="../css/skin.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/main.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="/My97DatePicker/WdatePicker.js"
</head>


    charset="utf-8"></script>

<script type="text/javascript">
    function isDisplayFreightTemplate() {
        var item = $("input[name='isFromFreight']:checked").val();
        if (item == "1")
            $("#trFreightTemplate").hide();
        else
            $("#trFreightTemplate").show();
    }
    $(function () {
        var sc = document.getElementById("selectCategory");
        var sac = document.getElementById("selectAddCategory");
        $("#btnAllAdd").click(function () {
            for (var i = 0; i < sc.options.length; i++) {
                var rs = false;
                for (var j = 0; j < sac.options.length; j++) {
                    if (sac.options[j].value == sc.options[i].value)
                        rs = true;
                }
                if (!rs) {
                    var selectItem = new Option();
                    if (sc.options[i].text.indexOf("┣") != -1)
                        selectItem.text = sc.options[i].text.substring(sc.options[i].text.indexOf("┣") + 1);
                    else
                        selectItem.text = sc.options[i].text;
                    selectItem.value = sc.options[i].value
                    sac.options.add(selectItem);
                }
            }
            getBrands();
        });
        $("#btnAdd").click(function () {
            for (var i = 0; i < sc.options.length; i++) {
                if (sc.options[i].selected) {
                    var rs = false;
                    for (var j = 0; j < sac.options.length; j++) {
                        if (sac.options[j].value == sc.options[i].value)
                            rs = true;
                    }
                    if (!rs) {
                        var selectItem = new Option();
                        if (sc.options[i].text.indexOf("┣") != -1)
                            selectItem.text = sc.options[i].text.substring(sc.options[i].text.indexOf("┣") + 1);
                        else
                            selectItem.text = sc.options[i].text;
                        selectItem.value = sc.options[i].value
                        sac.options.add(selectItem);
                    }
                }
            }
            getBrands();

        });
        $("#btnDelete").click(function () {
            for (var i = (sac.options.length - 1); i > -1; i--) {
                if (sac.options[i].selected) {
                    sac.options.remove(i);
                }

            }
            getBrands();
        });
        $("#btnAllDelete").click(function () {
            for (var i = (sac.options.length - 1); i > -1; i--) {
                sac.options.remove(i);
            }
            getBrands();
        });
    });
    function getBrands() {
        var sac = document.getElementById("selectAddCategory");
        if (sac.options.length == 0)
            $("#goodsBrand").html("<select id=\"selectBrand\" name=\"brand\"><option value=\"0\">请选择品牌...</option></select>")
        else {
            var cid = "";
            for (var j = 0; j < sac.options.length; j++) {
                if (j == 0)
                    cid += sac.options[j].value;
                else
                    cid += "," + sac.options[j].value;
            }
            var gb = Gift.WebApp.Goods_ajax.GetBrandByCategoryIdentity(cid).value;
            $("#goodsBrand").html(gb);
        }
    }
</script>
  <link rel="stylesheet" href="../kindEditor/plugins/code/prettify.css" />
   <script charset="utf-8" src="../kindEditor/kindeditor.js"></script>
	<script charset="utf-8" src="../kindEditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../kindEditor/plugins/code/prettify.js"></script>
	<script>
	    KindEditor.ready(function (K) {
	        var editor1 = K.create('#txtGoodsRemark', {
	            cssPath: '../kindEditor/plugins/code/prettify.css',
	            uploadJson: '../kindEditor/upload_json.ashx',
	            fileManagerJson: '../kindEditor/file_manager_json.ashx',
	            allowFileManager: true,
	            afterCreate: function () {
	                var self = this;
	                K.ctrl(document, 13, function () {
	                    self.sync();
	                    K('form[name=form1]')[0].submit();
	                });
	                K.ctrl(self.edit.doc, 13, function () {
	                    self.sync();
	                    K('form[name=form1]')[0].submit();
	                });
	            }
	        });
	        prettyPrint();
	    });
      </script>

<body class="body">
    <table class="main" cellpadding="0" cellspacing="0">
     
        <tr>
         
            <td class="td_middle_middle">
                <div class="maincontent">
  <div  class="navgater"><img src="../images/module.gif" width="20" height="22" alt=""/>
所在位置：商品列表-> 商品添加

<a style=" display:block; float:right;" href="javascript:location.href=document.referrer;" ><img src="../images/history.gif" border="0" /></a>
</div>

                    <form id="form1" runat="server" enctype="multipart/form-data">
                        <!--HTML部分-->
                        <table border="0" cellpadding="0" cellspacing="0" id="secTable">
                            <tr style="text-align: center;">
                                <td id="td1" class="sec2" onclick="secBoard(1);">
                                    商品基本信息</td>
                                <td id="td2" class="sec1" onclick="secBoard(2);">
                                    商品展示图片</td>
                                <td id="td3" class="sec1" onclick="secBoard(3);">
                                    商品销售规格</td>
                                <td id="td4" class="sec1" onclick="secBoard(4);">
                                    商品详细属性</td>
                            </tr>
                        </table>
                        <!--关于商品基本信息-->
                        <div id="tab1">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="td_title">
                                        商品名称：</td>
                                    <td class="td_content">
                                        <input id="txtGoodsName" type="text" runat="server" />*</td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        商品编号：</td>
                                    <td class="td_content">
                                        <input id="txtGoodsNo" type="text" runat="server" />*</td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        商品分类：</td>
                                    <td class="td_content">
                                        <table>
                                            <tr>
                                                <td style="width: 280px;">
                                                    <select id="selectCategory" name="category" multiple="multiple" class="select">
                                                        <%Response.Write(CategoryBind()); %>
                                                    </select>
                                                </td>
                                                <td style="text-align: center; width: 120px;">
                                                    <input id="btnAllAdd" type="button" value="添加所有" title="添加所有分类" class="formButton" /><br />
                                                    <br />
                                                    <input id="btnAdd" type="button" value="添加选取" title="添加选取分类" class="formButton" /><br />
                                                    <br />
                                                    <input id="btnDelete" type="button" value="移除选取" title="移除选取分类" class="formButton" /><br />
                                                    <br />
                                                    <input id="btnAllDelete" type="button" value="移除所有" title="移除所有分类" class="formButton" />
                                                </td>
                                                <td>
                                                    <select id="selectAddCategory" name="addCategory" multiple="multiple" class="select">
                                                    </select>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        商品品牌：</td>
                                    <td class="td_content">
                                        <span id="goodsBrand">
                                            <select id="selectBrand" name="brand">
                                                <option value="0">请选择品牌...</option>
                                            </select>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        生产产地：</td>
                                    <td class="td_content">
                                        <input id="txtOrigin" type="text" runat="server" /></td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        是否精品推荐：</td>
                                    <td class="td_content">
                                        <input id="rdIsBest1" name="isBest" type="radio" runat="server" value="1" />是&nbsp;&nbsp;<input
                                            id="rdIsBest0" name="isBest" type="radio" runat="server" value="0" />否
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        是否新品推荐：</td>
                                    <td class="td_content">
                                        <input id="rdIsNew1" name="isNew" type="radio" runat="server" value="1" />是&nbsp;&nbsp;<input
                                            id="rdIsNew0" name="isNew" type="radio" runat="server" value="0" />否
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        是否热销推荐：</td>
                                    <td class="td_content">
                                        <input id="rdIsTopSelling1" name="isTopSelling" type="radio" runat="server" value="1" />是&nbsp;&nbsp;<input
                                            id="rdIsTopSelling0" name="isTopSelling" type="radio" runat="server" value="0" />否
                                    </td>
                                </tr>
                            <tr>
                                    <td class="td_title">
                                        是否商城上架：</td>
                                    <td class="td_content">
                                        <input id="rdIsShelves1" name="isShelves" type="radio" runat="server" value="1" />是&nbsp;&nbsp;<input
                                            id="rdIsShelves0" name="isShelves" type="radio" runat="server" value="0" />否
                                    </td>
                                </tr>
                                    <tr>
                                    <td class="td_title">
                                        是否专区上架：</td>
                                    <td class="td_content">
                                        <input id="rdIsProfShelves1" name="isProfShelves" type="radio" runat="server" value="1" />是&nbsp;&nbsp;<input
                                            id="rdIsProfShelves0" name="isProfShelves" type="radio" runat="server" value="0" />否
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        是否打折促销：</td>
                                    <td class="td_content">
                                        <input id="rdIsPromote1" name="isPromote" type="radio" runat="server" value="1" />是&nbsp;&nbsp;<input
                                            id="rdIsPromote0" name="isPromote" type="radio" runat="server" value="0" />否
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        是否参与会员打折：</td>
                                    <td class="td_content">
                                        <input id="rdIsUserDiscount1" name="isUserDiscount" type="radio" runat="server" value="1" />是&nbsp;&nbsp;<input
                                            id="rdIsUserDiscount0" name="isUserDiscount" type="radio" runat="server" value="0" />否
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        优惠活动：</td>
                                    <td class="td_content">
                                        <input id="cbIsOrderFromFreight" name="isOrderFromFreight" type="checkbox" runat="server"/>订单满额免运费
                                        <input id="cbIsDiscount" name="isDiscount" type="checkbox" runat="server" />订单满额打折
                                        <input id="cbIsTotalReduce" name="isTotalReduce" type="checkbox" runat="server" />订单满额减少
                                        <input id="cbIsGifts" name="isGifts" type="checkbox" runat="server" />订单满额赠送礼品
                                        <input id="cbIsSendIntegral" name="isSendIntegral" type="checkbox" runat="server" />订单满额赠送积分
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        运费：</td>
                                    <td class="td_content">
                                        <input id="rdIsFromFreight1" name="isFromFreight" type="radio" runat="server" value="1"
                                            onclick="isDisplayFreightTemplate();" />卖家承担&nbsp;&nbsp;<input id="rdIsFromFreight0"
                                                name="isFromFreight" type="radio" runat="server" value="0" onclick="isDisplayFreightTemplate();" />买家承担
                                    </td>
                                </tr>
                                <tr id="trFreightTemplate">
                                    <td class="td_title">
                                        运费模版：</td>
                                    <td class="td_content">
                                        <select id="selectFreightTemplate" name="freightTemplate" onchange="setFreightTemplate();">
                                            <option value="0">请选择运费模版...</option>
                                            <%Response.Write(FreightTemplateBind()); %>
                                        </select>
                                        <span id="spFreightTemplate"></span>
                                    </td>
                                </tr>
                                  <tr>
                                    <td class="td_title">
                                        专区类别：</td>
                                    <td class="td_content">
                                         <asp:DropDownList id="ddlProfessionType" runat="server">
                                         </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        商品详细描述
                                    </td>
                                    <td class="td_content">
                                    <textarea id="txtGoodsRemark" cols="100" rows="8"  style="width:100%;height:400px;visibility:hidden;" runat="server"></textarea>
         
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        页面关键词：</td>
                                    <td class="td_content">
                                        <input id="txtKeywords" type="text" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_title">
                                        页面描述：</td>
                                    <td class="td_content">
                                        <textarea id="txtaDescription" runat="server" cols="20" rows="2"></textarea>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <!--关于商品展示图片-->
                        <div id="tab2" style="display: none;">
                            <input id="addGallery" type="button" class="formButton" value="添加图片" title="添加图片"
                                onclick="AddGoodGallerys();" />
                            <table border="0" cellpadding="0" cellspacing="0" id="GoodGallerys">
                                <tr>
                                    <td style="width: 40%;">
                                        商品图片</td>
                                    <td style="width: 20%;">
                                        图片说明</td>
                                    <td style="width: 40%;">
                                        操作</td>
                                </tr>
                                <tr>
                                    <td>
                                        <input name="hdGoodGallery" type="hidden" value="0" /><input name="fileGoodGallery"
                                            type="file" /><span class="imgClass"> *分辨率大于500*500的等比例图片</span></td>
                                    <td>
                                        <input name="imgAlt" type="text" />
                                    </td>
                                    <td>
                                        <input type="button" class="formButton" value="删除" title="删除图片" onclick="delGalleryInput(this.parentNode.parentNode.rowIndex);" /></td>
                                </tr>
                            </table>
                        </div>
                        <!--关于商品销售规格-->
                        <div id="tab3" style="display: none;">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td style="width: 30%;">
                                        <%Response.Write(SpecificationsBind()); %>
                                    </td>
                                    <td style="width: 70%;">
                                        <span id="Specifications"></span>
                                    </td>
                                </tr>
                            </table>
                            <table border="0" cellpadding="0" cellspacing="0" id="GoodsEntitysSpecifications">
                                <tr>
                                    <td>
                                        条形码</td>
                                    <td>
                                        货号</td>
                                    <td>
                                        销售价</td>
                                    <td>
                                        成本价</td>
                                    <td>
                                        市场价</td>
                                    <td>
                                        赠送积分</td>
                                    <td>
                                        重量</td>
                                    <td>
                                        重量单位</td>
                                    <td>
                                        库存</td>
                                    <td>
                                        操作</td>
                                </tr>
                                <tr>
                                    <td>
                                        <input name="barCode" type="text" class="specifications" /></td>
                                    <td>
                                        <input name="hdGoodsEntitys" type="hidden" value="0" /><input name="goodsArtno" type="text" class="specifications" /></td>
                                    <td>
                                        <input name="salePrice" type="text" class="specifications" value="0" /></td>
                                    <td>
                                        <input name="costPrice" type="text" class="specifications" value="0" /></td>
                                    <td>
                                        <input name="marketPrice" type="text" class="specifications" value="0" /></td>
                                    <td>
                                        <input name="giveIntegral" type="text" class="specifications" value="0" /></td>
                                    <td>
                                        <input name="goodsWeight" type="text" class="specifications" value="0" /></td>
                                    <td>
                                        <select name="selectWeightUnit">
                                            <option value="克" selected="selected">克 </option>
                                            <option value="千克">千克 </option>
                                            <option value="吨">吨 </option>
                                        </select>
                                    </td>
                                    <td>
                                        <input name="inventory" type="text" class="specifications" value="0" /></td>
                                    <td>
                                        <input id="btnAddGoodsEntitys" type="button" class="formButton" value="添加" title="添加货品"
                                            onclick="AddGoodsEntitys();" /></td>
                                </tr>
                            </table>
                        </div>
                        <!--关于商品详细属性-->
                        <div id="tab4" style="display: none;">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="td_title">
                                        商品类型：
                                    </td>
                                    <td>
                                        <select id="SelectGoodsType" name="sGoodsType" onchange="getAttributes();">
                                            <option value="0">请选择...</option>
                                            <%Response.Write(GoodsTypeBind()); %>
                                        </select>
                                    </td>
                                </tr>
                            </table>
                            <span id="goodsType"></span>
                        </div>
                        <asp:Button ID="btnSubmit" runat="server" Text="确  定" CssClass="formButton" OnClick="btnSubmit_Click"
                            OnClientClick="return checkGoodsForm();" />&nbsp;&nbsp;&nbsp;&nbsp;
                        <input id="btnBack" type="button" class="formButton" value=" 返  回 " onclick="location.href='goods_list.aspx';" />
                    </form>
                </div>
            </td>
           
        </tr>
      
    </table>
</body>
</html>
